import I.I;
import java.awt.BorderLayout;
import java.awt.Canvas;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.GridLayout;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.SocketTimeoutException;
import java.net.URL;
import java.net.URLEncoder;
import java.net.UnknownHostException;
import java.util.Random;
import java.util.concurrent.atomic.AtomicReference;
import javax.crypto.Cipher;
import javax.crypto.CipherInputStream;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.PBEParameterSpec;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;

public class MCUtils
{
  private static Cipher KKLI(int paramInt, String paramString)
  {
    Random localRandom = new Random(43287234L);
    byte[] arrayOfByte = new byte[8];
    localRandom.nextBytes(arrayOfByte);
    PBEParameterSpec localPBEParameterSpec = new PBEParameterSpec(arrayOfByte, 5);
    SecretKey localSecretKey = SecretKeyFactory.getInstance("PBEWithMD5AndDES").generateSecret(new PBEKeySpec(paramString.toCharArray()));
    Cipher localCipher = Cipher.getInstance("PBEWithMD5AndDES");
    localCipher.init(paramInt, localSecretKey, localPBEParameterSpec);
    return localCipher;
  }

  private static boolean Z(AtomicReference paramAtomicReference1, AtomicReference paramAtomicReference2)
  {
    try
    {
      File localFile = new File(I.I(), "lastlogin");
      Cipher localCipher = KKLI(2, "passwordfile");
      DataInputStream localDataInputStream;
      if (localCipher != null)
        localDataInputStream = new DataInputStream(new CipherInputStream(new FileInputStream(localFile), localCipher));
      else
        localDataInputStream = new DataInputStream(new FileInputStream(localFile));
      paramAtomicReference1.set(localDataInputStream.readUTF());
      paramAtomicReference2.set(localDataInputStream.readUTF());
      localDataInputStream.close();
      return true;
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
    }
    return false;
  }

  private static boolean add(AtomicReference paramAtomicReference1, AtomicReference paramAtomicReference2)
  {
    JPanel localJPanel = new JPanel();
    localJPanel.setLayout(new GridLayout(4, 1));
    JTextField localJTextField = new JTextField(12);
    JPasswordField localJPasswordField = new JPasswordField(12);
    localJPanel.add(new JLabel("Username"));
    localJPanel.add(localJTextField);
    localJPanel.add(new JLabel("Password"));
    localJPanel.add(localJPasswordField);
    JFrame localJFrame = new JFrame("Minecraft Login");
    localJFrame.setDefaultCloseOperation(3);
    localJFrame.setSize(300, 300);
    localJFrame.setLocationRelativeTo(null);
    localJFrame.setVisible(false);
    int i = JOptionPane.showConfirmDialog(localJFrame, localJPanel, "Put username and password", 2, 3);
    if (i == 0)
    {
      paramAtomicReference1.set(localJTextField.getText());
      paramAtomicReference2.set(new String(localJPasswordField.getPassword()));
      return true;
    }
    return false;
  }

  private static gg addWindowListener(String paramString1, String paramString2)
  {
    String[] arrayOfString = append(paramString1, paramString2);
    if (arrayOfString.length < 3)
      return null;
    Frame localFrame = new Frame("Minecraft");
    Canvas localCanvas = new Canvas();
    localFrame.setLayout(new BorderLayout());
    localFrame.add(localCanvas, "Center");
    localCanvas.setPreferredSize(new Dimension(854, 480));
    localFrame.pack();
    localFrame.setLocationRelativeTo(null);
    gg localgg = new gg(localFrame, localCanvas, null, 854, 480, false, localFrame);
    Thread localThread = new Thread(localgg, "Minecraft main thread");
    localThread.setPriority(10);
    localgg.l = false;
    localgg.j = "www.minecraft.net";
    localgg.i = new dy(arrayOfString[2].trim(), arrayOfString[3].trim());
    localFrame.setVisible(true);
    localFrame.addWindowListener(new gk(localgg, localThread));
    localThread.start();
    return localgg;
  }

  public static final gg I()
  {
    AtomicReference localAtomicReference1 = new AtomicReference();
    AtomicReference localAtomicReference2 = new AtomicReference();
    gg localgg = null;
    if (Z(localAtomicReference1, localAtomicReference2))
    {
      localgg = addWindowListener((String)localAtomicReference1.get(), (String)localAtomicReference2.get());
      if (localgg != null)
        return localgg;
    }
    while (add(localAtomicReference1, localAtomicReference2))
    {
      localgg = addWindowListener((String)localAtomicReference1.get(), (String)localAtomicReference2.get());
      if (localgg != null)
        break;
      JOptionPane.showMessageDialog(null, "Incorrect username or password.", "MCCheat", 0);
    }
    return localgg;
  }

  public static final String[] append(String paramString1, String paramString2)
  {
    String str1 = "";
    try
    {
      str1 = "user=" + URLEncoder.encode(paramString1, "UTF-8") + "&password=" + URLEncoder.encode(paramString2, "UTF-8") + "&version=" + 12;
    }
    catch (UnsupportedEncodingException localUnsupportedEncodingException)
    {
      localUnsupportedEncodingException.printStackTrace();
    }
    String str2 = close("http://www.minecraft.net/game/getversion.jsp", str1);
    if (str2 == null)
      return new String[0];
    if (!str2.contains(":"))
      return new String[0];
    String[] arrayOfString = str2.split(":");
    return arrayOfString;
  }

  public static final String close(String paramString1, String paramString2)
  {
    HttpURLConnection localHttpURLConnection = null;
    try
    {
      URL localURL = new URL(paramString1);
      localHttpURLConnection = (HttpURLConnection)localURL.openConnection();
      localHttpURLConnection.setReadTimeout(3000);
      localHttpURLConnection.setConnectTimeout(3000);
      localHttpURLConnection.setRequestMethod("POST");
      localHttpURLConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
      localHttpURLConnection.setRequestProperty("Content-Length", Integer.toString(paramString2.getBytes().length));
      localHttpURLConnection.setRequestProperty("Content-Language", "en-US");
      localHttpURLConnection.setUseCaches(false);
      localHttpURLConnection.setDoInput(true);
      localHttpURLConnection.setDoOutput(true);
      localDataOutputStream = new DataOutputStream(localHttpURLConnection.getOutputStream());
      localDataOutputStream.writeBytes(paramString2);
      localDataOutputStream.flush();
      localDataOutputStream.close();
      InputStream localInputStream = localHttpURLConnection.getInputStream();
      BufferedReader localBufferedReader = new BufferedReader(new InputStreamReader(localInputStream));
      StringBuffer localStringBuffer = new StringBuffer();
      String str1;
      while ((str1 = localBufferedReader.readLine()) != null)
      {
        localStringBuffer.append(str1);
        localStringBuffer.append('\r');
      }
      localBufferedReader.close();
      String str2 = localStringBuffer.toString();
      return str2;
    }
    catch (SocketTimeoutException localSocketTimeoutException)
    {
      JOptionPane.showMessageDialog(null, "Failure to connect to Minecraft.net, please try again later.", "MCCheat", 2);
      System.exit(0);
      localDataOutputStream = null;
      return localDataOutputStream;
    }
    catch (UnknownHostException localUnknownHostException)
    {
      JOptionPane.showMessageDialog(null, "Failure to connect to Minecraft.net, please try again later.", "MCCheat", 2);
      System.exit(0);
      localDataOutputStream = null;
      return localDataOutputStream;
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
      DataOutputStream localDataOutputStream = null;
      return localDataOutputStream;
    }
    finally
    {
      if (localHttpURLConnection != null)
        localHttpURLConnection.disconnect();
    }
    throw localObject;
  }
}

/* Location:           C:\Users\Administrator\Desktop\MCCheat_1.9\
 * Qualified Name:     MCUtils
 * JD-Core Version:    0.6.0
 */